feat: add HarmonyOS platform support#679
Conversation
|
Context for this PR: This PR is a re-implementation of HarmonyOS platform support based on the latest main branch. I previously submitted an initial version in #613, but that was based on an older main branch (roughly 89 commits behind). During that period, the main branch evolved Both versions implement the same feature set, but this version:
If maintainers previously reviewed #613, the core platform implementation logic (under platforms/harmonyos/) remains essentially unchanged — this is primarily an adaptation to the |
|
Thanks for the contribution. This is a big piece of work, and directionally the approach looks right to me: HDC as the transport, I found a few things that I think need fixing before we can land this:
Validation I ran:
I also tried to validate locally. I have DevEco Studio installed on macOS/Apple Silicon; bundled Could you share the exact steps you used to install/create a HarmonyOS emulator on macOS? A DevEco menu path is fine, but a CLI-friendly flow would be even better if one exists. That would help us verify this against a real emulator in addition to the physical-device testing you already did. |
|
To use the HarmonyOS emulator, follow these steps: I need some time to review the other 4 bux. |
- Fix duplicate import in snapshot.ts - Wire HarmonyOS recording into daemon recording path (start/stop) - Reject HarmonyOS permission deny with explicit UNSUPPORTED_OPERATION - Fix ui-input typo to uiInput in app-lifecycle.ts - Add harmonyos to Node client normalizers (normalizeOpenDevice, buildClientDevicePlatformFields) - Update remote config schema and CLI tests to include harmonyos platform
…tform gaps - capabilities: remove harmonyos support from logs and perf (not yet implemented) - dispatch-interactions: explicitly reject read command on HarmonyOS - client-shared: add harmonyos serial to device identifiers - session-open-surface: include serial for harmonyos open results - client-output: add harmonyos appstate output formatting - boot-diagnostics: add HDC_TRANSPORT_UNAVAILABLE for harmonyos and extend platform type - post-gesture-stabilization: include harmonyos in supported platforms - interaction-outcome-policy: include harmonyos in supported platforms - replay/script-utils: include harmonyos platform in script args - maestro/runtime-targets: correctly map harmonyos platform instead of falling back to ios - maestro/command-mapper: allow openLink on harmonyos with appId
- capabilities: remove harmonyos clipboard support because uitest uiInput has no getClipboard/setClipboard commands - test docs: fix settings dark-mode → settings appearance dark - test docs: fix fling → gesture fling with correct args
The perf handler was missing an isCommandSupportedOnDevice check, so it returned empty metrics instead of UNSUPPORTED_OPERATION for platforms where perf is not supported (e.g. harmonyos).
- Fix duplicate import in snapshot.ts - Wire HarmonyOS recording into daemon recording path (start/stop) - Reject HarmonyOS permission deny with explicit UNSUPPORTED_OPERATION - Fix ui-input typo to uiInput in app-lifecycle.ts - Add harmonyos to Node client normalizers (normalizeOpenDevice, buildClientDevicePlatformFields) - Update remote config schema and CLI tests to include harmonyos platform Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
4890f73 to
d66c8e0
Compare
|
Re-checking this PR today: it is currently blocked by merge conflicts ( Please rebase, resolve conflicts, and rerun at least |
|
Thanks for this substantial contribution, @wz9527 — adding a whole new platform is a lot of work, and the integration here is unusually disciplined for a first-pass new-platform PR. The shared-infrastructure edits are almost entirely additive, the exhaustive Regression risk: Low. Shared-file changes are additive branches guarded by Needs rebasing (required)This PR is Blocking
Non-blocking
Overall: convention-compliant and low-risk to existing platforms. The two blockers are HarmonyOS-local correctness issues plus the mandatory rebase — no cross-platform regression. Nice work. 🤖 Automated review via Claude Code |
|
When can it be integrated and the official version be released? |
|
Still need to hook the simulator (have the device), will get to it soon hopefully! |
|
@wz9527 👋 Just checking in — any update on this? The maintainers have left some feedback and it seems things have gone quiet. Would you still be planning to address them, or would you be open to someone else picking this up? |
Summary
Add HarmonyOS (OpenHarmony / HarmonyOS NEXT) platform support to agent-device, enabling CLI control of HarmonyOS physical devices and emulators via HDC (HarmonyOS Device
Connector).
What was implemented
Device connection and discovery
hdc -t <serial>)devicescommand lists connected HarmonyOS devicesApp lifecycle
apps: lists installed apps viabm dump -aandwukong appinfo, automatically resolves launchAbilityopen: 5-strategy launch chain (wukong → uitest → hdc aa start → EntryAbility → system default)close: stops app viaaa force-stopinstall/reinstall: installs HAP packages viahdc install / uninstallappstate: reads foreground app viaaa dump -lUI interactions
uitest uiInputcommandsstatus,dismiss, andenter; detects keyboard visibility via WindowManagerService dumpfillincludes verification and retry (reads back text via dumpLayout snapshot to confirm)uitest uiInput getClipboard / setClipboardSnapshot and screenshot
uitest dumpLayout, supportsinteractiveOnly,compact,depth,scope, andrawmodessnapshot_displaySystem functions
accept,dismiss, andwait; includes bilingual (EN/CN) button matching and auto-dismiss of system dialogshiloghidumperaa sendCLI and help
--platform harmonyosflag supportagent-device help harmonyoscomplete help topicKnown limitations
The following commands are not supported on HarmonyOS:
boot: device bootnetwork: network traffic capture (hilog lacks PID filtering, cannot implement reliably)pinch/rotate-gesture/transform-gesture: multi-touch gestures (uitest does not support)Test results
Tested on HarmonyOS NEXT physical device (22M0223824043030):